package com.jwthhealth_pub.guardian.view;

import android.app.AlertDialog;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.jwthhealth_pub.R;
import com.jwthhealth_pub.common.base.BaseActivity;
import com.jwthhealth_pub.common.view.TitleLayout;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

import static com.jwthhealth_pub.common.LogUtil.makeLogTag;

/**
 * 添加监护人
 * Created by yang on 2017/12/19.
 *
 */

public class AddGuardianActivity extends BaseActivity  {

    private final String TAG = makeLogTag(AddGuardianActivity.class);

    @BindView(R.id.title_layout)
    TitleLayout titleLayout;
    @BindView(R.id.tv_add)
    TextView tv_add;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_addguardian);
        ButterKnife.bind(this);
    }
    @OnClick(R.id.tv_add)
    //添加监护人
    public void addClick(){
        showAlertDialog();
    }


    //这是添加监护人的弹出框
    private void showAlertDialog() {

        final AlertDialog dialog = new AlertDialog.Builder(this).create();
        dialog.setView(LayoutInflater.from(this).inflate(R.layout.alert_show_add_guardian, null));
        dialog.show();
        dialog.getWindow().setContentView(R.layout.alert_show_add_guardian);
        dialog.getWindow().setBackgroundDrawableResource(android.R.color.transparent); //设置对话框背景透明 ，对于AlertDialog 就不管用了
        TextView btnPositive = (TextView) dialog.findViewById(R.id.btn_ok);
        btnPositive.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View arg0) {
                dialog.dismiss();
            }
        });
    }
    protected void title() {
        titleLayout.setOnTitleLayoutListener(new TitleLayout.TitleLayoutListener() {
            @Override
            public void leftclick() {
                finish();
            }

            @Override
            public void leftTextClick() {

            }

            @Override
            public void rightclick() {

            }

            @Override
            public void rightTextClick() {

            }
        });
    }
}
